package com.class05.dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

/**
 * @ClassDescription:
 * @JdkVersion: 17
 * @Author: yxy
 * @Created: 2023/11/7 19:35
 */
@Repository
public class StudentDao {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    public void updateNameById(String name,Integer id){
        String sql = "update students set name = ? where id = ?;";
        jdbcTemplate.update(sql, name, id);
    }

    public void updateAgeById(Integer age,Integer id){
        String sql = "update students set age = ? where id = ?;";
        jdbcTemplate.update(sql,age,id);
    }

}
